<?php /*a:3:{s:65:"D:\laragon\www\jiaqueshop\application\manage\view\slides_add.html";i:1585363238;s:59:"D:\laragon\www\jiaqueshop\application\manage\view\base.html";i:1596192950;s:68:"D:\laragon\www\jiaqueshop\application\manage\view\public_upload.html";i:1591401853;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
	<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="/static/public/awesome/css/font-awesome.min.css" />

<link rel="stylesheet" href="/static/public/layui/css/layui.css" />

<link rel="stylesheet" href="/static/public/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/static/manage/css/style.css" />

	<link rel="stylesheet" href="/static/public/dist/zoomify.min.css">
	
<script src="/static/public/kindeditor/kindeditor-all.js"></script>
<script src="/static/public/kindeditor/lang/zh_CN.js"></script>
<script src="/static/public/ueditor/ueditor.config.js?t=<?php echo time();?>"></script>
<script src="/static/public/ueditor/ueditor.all.min.js"></script>
<script src="/static/public/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body>
<?php if($is_auth): ?>

<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="<?php echo url('index/welcome'); ?>"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>系统</span>
            <span class="icon-angle-right"></span>
            <span>幻灯片</span>
            <span class="icon-angle-right"></span>
            <span><?php echo !empty($info) ? '编辑'  :  '添加'; ?>幻灯片</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-form">
                <form class="layui-form" id="j_form">
                    <table class="m-table">
                        <thead>
                        <tr>
                            <th colspan="2"><?php echo !empty($info) ? '编辑'  :  '添加'; ?>幻灯片</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td width="15%"><label for="title">幻灯片标题<em>*</em></label></td>
                            <td><input type="text" class="u-ipt u-ipt-long" name="title" id="title" placeholder="请输入幻灯片标题" value="<?php echo htmlentities($info['title']); ?>" /></td>
                        </tr>
                        <tr>
                            <td><label for="">幻灯片分类<em>*</em></label></td>
                            <td>
                                <div class="lay-select">
                                    <select name="category_id">
                                        <option value="0">请选择幻灯片分类</option>
                                        <?php if(is_array($categories) || $categories instanceof \think\Collection || $categories instanceof \think\Paginator): if( count($categories)==0 ) : echo "" ;else: foreach($categories as $key=>$category): ?>
                                        <option value="<?php echo htmlentities($category['id']); ?>"<?php if($info['category_id'] == $category['id']): ?> selected<?php endif; ?>><?php echo htmlentities($category['name']); ?></option>
                                        <?php endforeach; endif; else: echo "" ;endif; ?>
                                    </select>
                                </div>
                            </td>
                        </tr>
<!--                        <?php if(is_array($html) || $html instanceof \think\Collection || $html instanceof \think\Paginator): if( count($html)==0 ) : echo "" ;else: foreach($html as $key=>$v): ?>-->
<!--                        <?php if($v['type'] == 'editor'): ?>-->
<!--                        <tr>-->
<!--                            <td colspan="2"><?php echo html_entity_decode($v['label']); ?></td>-->
<!--                        </tr>-->
<!--                        <tr>-->
<!--                            <td colspan="2"><?php echo html_entity_decode($v['value']); ?></td>-->
<!--                        </tr>-->
<!--                        <script>-->
<!--                            KindEditor.ready(function(K) {-->
<!--                                var editor = K.create('textarea[name="<?php echo htmlentities($v['name']); ?>"]', {-->
<!--                                    allowFileManager: true,-->
<!--                                    uploadJson: uploadJson,-->
<!--                                    fileManagerJson: fileManagerJson,-->
<!--                                    afterBlur: function () {-->
<!--                                        this.sync();-->
<!--                                    }-->
<!--                                });-->
<!--                            });-->
<!--                        </script>-->
<!--                        <?php else: ?>-->
<!--                        <tr>-->
<!--                            <td width="15%"><?php echo html_entity_decode($v['label']); ?></td>-->
<!--                            <td><?php echo html_entity_decode($v['value']); ?></td>-->
<!--                        </tr>-->
<!--                        <?php endif; ?>-->
<!--                        <?php endforeach; endif; else: echo "" ;endif; ?>-->
                        <tr>
                            <td><label for="">图片<em>*</em></label></td>
                            <td>
                                <button type="button" class="layui-btn u-upload-pic" data-name="image_id"><i class="layui-icon">&#xe67c;</i>上传图片</button>
                                <div class="m-pic">
                                    <ul>
                                        <?php echo attach_html($info['image_id'], 'image_id'); ?>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><label for="url">链接地址</label></td>
                            <td><input type="text" class="u-ipt u-ipt-long" name="url" id="url" placeholder="请输入链接地址" value="<?php echo htmlentities($info['url']); ?>" /></td>
                        </tr>
                        <tr style="display: none">
                            <td width="15%"><label for="">打开方式</label></td>
                            <td>
                                <div class="lay-select">
                                    <select name="target">
                                        <option value="0"<?php if($info['target'] == 0): ?> selected<?php endif; ?>>原窗口打开</option>
                                        <option value="1"<?php if($info['target'] == 1): ?> selected<?php endif; ?>>新窗口打开</option>
                                    </select>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td width="15%"><label for="">跳转类型</label></td>
                            <td>
                                <div class="lay-select">
                                    <select name="type">
                                        <option value="0"<?php if($info['type'] == 0): ?> selected<?php endif; ?>>图文</option>
                                        <option value="1"<?php if($info['type'] == 1): ?> selected<?php endif; ?>>商品</option>
                                        <option value="2"<?php if($info['type'] == 2): ?> selected<?php endif; ?>>商铺</option>
                                        <option value="3"<?php if($info['type'] == 3): ?> selected<?php endif; ?>>优惠券</option>
                                        <option value="4"<?php if($info['type'] == 4): ?> selected<?php endif; ?>>拼团商品</option>
                                        <option value="5"<?php if($info['type'] == 5): ?> selected<?php endif; ?>>商品列表</option>
                                    </select>
                                </div>
                            </td>
                        </tr>

                        <tr>
                            <td><label for="list_order">排序</label></td>
                            <td><input type="text" class="u-ipt u-ipt-small" name="list_order" id="list_order" placeholder="请输入排序值" value="<?php echo !empty($info['list_order']) ? htmlentities($info['list_order']) : 0; ?>" /><span>值越大越排在前面</span></td>
                        </tr>
                        <tr>
                            <td><label for="description">描述</label></td>
                            <td><div class="m-textarea"><textarea name="description" class="u-tarea" id="description" placeholder="请输入描述"><?php echo htmlentities($info['description']); ?></textarea></div></td>
                        </tr>
						
                            <!--<tr>-->
                                <!--<td>区域</td>-->
                                <!--<td>-->
                                    <!--<div class="form-select" style="display: flex">-->
                                        <!--<select name="province" lay-filter="province"></select>-->
                                        <!--<select name="city" lay-filter="city"></select>-->
                                        <!--<select name="district"></select>-->
                                    <!--</div>-->
                                <!--</td>-->
                            <!--</tr>-->
                        </tbody>
                    </table>
                    <div class="m-form-btn"><input type="hidden" name="id" value="<?php echo htmlentities($info['id']); ?>"><button id="j_btn" class="u-btn">确定提交</button></div>
                </form>
            </div>
        </div>
    </div>
</div>

<?php endif; ?>
<input type="hidden" name="action_uri" value="<?php echo url('action'); ?>" />

<input type="hidden" name="redirect_uri" value="<?php echo url('index'); ?>" />

<input type="hidden" name="region_uri" value="/manage/regions/regions" />
<script src="/static/public/js/jquery-1.10.2.js"></script>
<script src="/static/public/js/maniac.ui.js"></script>
<script src="/static/public/layui/layui.js" charset="utf-8"></script>
<script src="/static/public/js/aes.js"></script>
<script src="/static/public/js/mode-ecb-min.js"></script>
<script src="/static/public/js/utils.js"></script>
<script src="/static/public/js/dialog.js"></script>
<script src="/static/manage/js/form.js"></script>
<script src="/static/manage/js/js.js"></script>
<script src="/static/public/js/app.js"></script>
<script src="/static/public/js/encrypt.js"></script>
<script src="/static/public/dist/zoomify.min.js"></script>
<script type="text/javascript">
    $('.fdzoom').zoomify();
</script>

<script>
var aesKey = '<?php echo htmlentities($encrypt_key); ?>';
    $(function(){
        layui.use('layer', function(){
            var user_exists = parseInt('<?php echo !empty($user_exists) ? 1  :  0; ?>');
            var user_forbidden = parseInt('<?php echo !empty($user_forbidden) ? 1  :  0; ?>');
            var quit_force = parseInt('<?php echo !empty($quit_force) ? 1  :  0; ?>');
            var is_auth    = parseInt('<?php echo !empty($is_auth) ? 1  :  0; ?>');
            
            if (user_exists) {
                dialog.error('您所登录的用户已被删除', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (user_forbidden) {
                dialog.error('您的账户已被禁用', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }

            if (quit_force) {
                dialog.error('同一账户同一时间只能一人在线', function(){
                	top.location.href = '/manage';
                    return false;
                });
            }
            
            if (!is_auth) {
                dialog.error('您没有权限执行此操作', function(){
                    window.location.href = history.go(-1);
                    return false;
                });
            }
        });
    })
</script>

<script>

    /**

     * 上传图片

     * @param  {object}  uploader upload 对象

     * @param  {string}  ele      容器选择器

     * @param  {boolean} multiple 是否允许多图上传

     */

    function upload_pic(uploader, ele, multiple)

    {

        var signature = setSign();

        uploader.render({

            elem: ele,

            field: 'imgFile',

            multiple: multiple,

            url: '<?php echo url("/manage/upload/upload", ["path" => session("userid", "", session_prefix()), "type" => "image", "module" => request()->module() ?: "addons"]); ?>',

            headers: {signature: signature},

            done: function(ret){

                var index = dialog.loading();

                if (ret.status == 0) {

                    var name = $(this.item).attr('data-name');

                    // 上传完毕回调

                    if (multiple) {

                        // 上传多图
                        $(this.item).parent().find('.m-pics ul').append('<li><img src="' + ret.data.attach_uri + '" alt="" /><input type="hidden" name="' + name + '[desc][]" value="' + ret.data.id + '" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '[value][]" value="' + ret.data.id + '" /></li>');
                    } else {

                        // 上传单图

                        $(this.item).parent().find('.m-pic ul').html('<li><img src="' + ret.data.attach_uri + '" alt="" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '" value="' + ret.data.id + '" /></li>');

                    }

                    layer.close(index);

                } else {

                    dialog.error(ret.message);

                    layer.close(index);
                }
            }
        })
    }


    /**
     * 上传图片
     * @param  {object}  uploader upload 对象
     * @param  {string}  ele      容器选择器
     * @param  {boolean} multiple 是否允许多图上传
     */
    function sxupload_pic(uploader, ele, multiple)
    {
        var signature = setSign();
        uploader.render({
            elem: ele,
            field: 'imgFile',
            multiple: multiple,
            url: '<?php echo url("api/v1/upload", ["path" => session("userid", "", session_prefix()), "type" => "image", "module" => request()->module() ?: "addons"]); ?>',
            headers: {signature: signature},
            done: function(ret){
                var index = dialog.loading();
                if (ret.status == 0) {
                    var name = $(this.item).attr('data-name');
                    // 上传完毕回调
                    if (multiple) {
                        // 上传多图
                        $(this.item).parent().find('.m-pics ul').append('<li><img src="' + ret.data.attach_uri + '" alt="" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '[value][]" value="' + ret.data.id + '" /></li>');
                    } else {
                        // 上传单图
                        $(this.item).parent().find('.m-pic ul').html('<li><img src="' + ret.data.attach_uri + '" alt="" /><a class="u-item"><i class="icon icon-remove"></i></a><input type="hidden" name="' + name + '" value="' + ret.data.id + '" /></li>');
                    }
                    layer.close(index);
                } else {
                    dialog.error(ret.message);

                    layer.close(index);
                }

            }

        })

    }



    /**

     * 上传附件

     * @param  {object}  uploader upload 对象

     * @param  {string}  ele      容器选择器

     */

    function upload_file(uploader, ele)

    {

        uploader.render({

            elem: ele,

            field: 'imgFile',

            accept: 'file',

            url: '<?php echo url("manage/upload/filemanager", ["path" => session("userid", "", session_prefix()), "type" => "file", "module" => request()->module() ?: "addons"]); ?>',

            done: function(ret){

                var index = dialog.loading();

                if (ret.status == 0) {

                    var name = $(this.item).attr('data-name');

                    // 上传完毕回调

                    $(this.item).parent().find('.m-files ul').append('<li><i class="icon-paper-clip"></i><input type="text" name="'+name+'[name][]" value="' + ret.data.title + '" /><a data-md5-file="' + ret.data.md5_file + '" data-id="' + ret.data.id + '" class="u-download">下载</a><a class="u-item" data-id="' + ret.data.id + '">删除</a><input type="hidden" name="' + name + '[value][]" value="' + ret.data.id + '" /></li>');

                    $(this.item).parent().find('.m-files').show();

                    layer.close(index);

                } else {

                	

                    dialog.error(ret.message);



                    layer.close(index);

                }

            }

        })

    }



    layui.use(['upload'], function(ele, multiple){

        // 得到 upload 对象

        var upload = layui.upload;

        // 上传单图

        upload_pic(upload, '.u-upload-pic', false);

        // 上传多图

        upload_pic(upload, '.u-upload-pics', true);

        // 上传附件

        upload_file(upload, '.u-upload-file');

        //双喜
        sxupload_pic(upload, '.sxu-upload-pic', false);
        sxupload_pic(upload, '.sxu-upload-pics', true);
    });

</script>
<!--<script>-->
    <!--layui.use(['layer', 'form'], function(){-->
        <!--var layer  = layui.layer,-->
                <!--form   = layui.form;-->
        <!--var province_id ="<?php echo htmlentities($info['province']); ?>";-->
        <!--var city ="<?php echo htmlentities($info['city']); ?>";-->
        <!--var district ="<?php echo htmlentities($info['district']); ?>";-->
        <!--//城市三级联动-->
        <!--var p_options="";-->
        <!--var c_options="";-->
        <!--var a_options="";-->
        <!--$.getJSON("/static/data/address.json", "", function(data) {-->
            <!--//each循环 使用$.each方法遍历返回的数据date-->
            <!--$.each(data, function(i, item) {-->
                <!--// console.log(item)-->
                <!--p_options+="<option value='"+item.region_id+"'>"+item.region_name+"</option>";-->
                <!--if(item.region_id==province_id){-->
                    <!--$.each(item.child, function(i, citem) {-->
                        <!--c_options+="<option value='"+citem.region_id+"'>"+citem.region_name+"</option>";-->
                        <!--if(citem.region_id==city){-->
                            <!--$.each(citem.child, function(i, aitem) {-->
                                <!--a_options+="<option value='"+aitem.region_id+"'>"+aitem.region_name+"</option>";-->
                            <!--});-->
                        <!--}-->
                    <!--});-->
                <!--}-->
            <!--});-->

            <!--//省-->
            <!--$("select[name='province']").html(p_options);-->
            <!--$("select[name='province'] option").attr("selected",false);-->
            <!--$("select option[value='"+province_id+"']").attr("selected",true);-->

            <!--$("select[name='city']").html(c_options);-->
            <!--$("select[name='city'] option").attr("selected",false);-->
            <!--$("select option[value='"+city+"']").attr("selected",true);-->

            <!--$("select[name='district']").html(a_options);-->
            <!--$("select[name='district'] option").attr("selected",false);-->
            <!--$("select option[value='"+district+"']").attr("selected",true);-->

            <!--form.render('select');-->
        <!--});-->
    <!--});-->
<!--</script>-->

</body>
</html>